﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using VOL.Core.Utilities;
using VOL.Entity.AttributeManager;
using VOL.Entity.DomainModels;
using VOL.Entity.DomainModels.EvaluateNurseCare;
using VOL.SmartMecial.IServices.DoctorManage;

namespace VOL.WebApi.Controllers.SmartMecial
{
    [Route("api/DoctorManageController")]
    [PermissionTable(Name = "DoctorManageController")]
    public class DoctorManageController : ControllerBase
    {
        private readonly IDoctorManageService service;
        private readonly ITellManageService _tellService;

        public DoctorManageController(IDoctorManageService service, ITellManageService tellService)
        {
            this.service = service;
            this._tellService = tellService;
        }

        /// <summary>
        /// 获取患者信息(患者详情页)
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetPateientList")]
        public async Task<WebResponseContent> GetPateientList()
        {
            return await service.GetPateientList();
        }

        /// <summary>
        /// 获取所有患者信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetPatients")]
        public List<Patient> GetPatients()
        {
            return service.GetPatients();
        }

        /// <summary>
        /// 获取所有入量信息
        /// </summary>
        /// <param name="patientCode">患者编号</param>
        /// <returns>返回</returns>
        [HttpGet("GetinRecord")]
        public List<InRecord> GetinRecord(string patientCode)
        {
            return service.GetinRecord(patientCode);
        }

        /// <summary>
        /// 获取所有出量信息
        /// </summary>
        /// <param name="patientCode">患者编号</param>
        /// <returns>返回</returns>
        [HttpGet("GetOutRecord")]
        public List<OutRecord> GetOutRecord(string patientCode)
        {
            return service.GetOutRecord(patientCode);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="patientCode"></param>
        /// <returns></returns>
        [HttpGet("GetPatientPatientReCord")]
        public async Task<WebResponseContent> GetPatientPatientReCord(string patientCode)
        {
            return await service.GetPatientPatientReCord(patientCode);
        }




        /// <summary>
        /// 查询医嘱列表
        /// </summary>
        /// <param name="userCode">患者编号</param>
        /// <returns>返回结果</returns>
        [HttpGet("GetTellList")]
        public async Task<WebResponseContent> GetTellList(string? patientName)
        {
            return await _tellService.GetTellList(patientName);
        }

        /// <summary>
        /// 添加医嘱
        /// </summary>
        /// <param name="tellModel">医嘱实体</param>
        /// <returns>返回结果</returns>
        [HttpPost("AddTell")]
        public async Task<WebResponseContent> AddTell([FromBody]TellModel tellModel)
        {
            return await _tellService.AddTell(tellModel);
        }

        /// <summary>
        /// 编辑医嘱
        /// </summary>
        /// <param name="tellModel">医嘱实体</param>
        /// <returns>返回结果</returns>
        [HttpPost("UpdTell")]
        public async Task<WebResponseContent> UpdTell([FromBody] TellModel tellModel)
        {
            return await _tellService.UpdTell(tellModel);
        }
    }
}
